<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>hez2010</title>
  
  
  
  <!--link rel="stylesheet" href="//cdn.jsdelivr.net/highlight.js/9.10.0/styles/github-gist.min.css"-->
  
<link rel="stylesheet" href="//cdn.jsdelivr.net/highlight.js/9.10.0/styles/github-gist.min.css">

  
<link rel="stylesheet" href="/css/style.css">

<!-- hexo injector head_end start -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css">

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hexo-math@4.0.0/dist/style.css">
<!-- hexo injector head_end end --><meta name="generator" content="Hexo 5.1.1"></head>

<body>
<div class="Shell">
    <aside class='SideBar'>
    <section class='avatar' style="background-image: url()">
        <div class='av-pic' style="background-image: url(/assets/avatar.jpg)">
        </div>
    </section>
    <section class='menu'>
        <div>hez2010</div>
        
            <div>软件工程导论</div>
        
        <ul>
          
            <a href="/" class="Btn">
              <li>Home</li>
            </a>  
          
            <a href="/archives/" class="Btn">
              <li>Archive</li>
            </a>  
          
        </ul>
    </section>
    <section class="media">
        
            
                <a target="_blank" rel="noopener" href="https://github.com/hez2010">
                    <img src="/assets/github.svg" />
                </a>
            
        
    </section>
</aside>

    <div class="container">
        <div data-pager-shell>
            <ul class="Index">
  
    <header class='PageTitle'>
        <h1>{ 软件工程导论 }</h1>
    </header>
  
  
    <li>
      <article class='ListView'>
    <header class="title">
      
        <h1>
          <a href="/2021/01/05/snake_ai/">智能蛇</a>
        </h1>
      
      <div class='ListMeta'>
  <time datetime="2021-01-05T13:27:38.939Z" itemprop="datePublished">
    2021-01-05
  </time>
  
  
  / 
  <ul>
    
  <li class="meta-text">
  { <a href="/categories/%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B%E5%AF%BC%E8%AE%BA/">软件工程导论</a> }
  </li>


  </ul>
  
</div>

    </header>
    <div>
      
        <h1 id="C-编写智能贪吃蛇小游戏"><a href="#C-编写智能贪吃蛇小游戏" class="headerlink" title="C 编写智能贪吃蛇小游戏"></a>C 编写智能贪吃蛇小游戏</h1><p>项目代码见：<a target="_blank" rel="noopener" href="https://gitee.com/hez2010/snake_ai">https://gitee.com/hez2010/snake_ai</a></p>
<h2 id="整体框架"><a href="#整体框架" class="headerlink" title="整体框架"></a>整体框架</h2><p>智能蛇的流程如下：</p>
<ol>
<li>清除屏幕</li>
<li>生成食物</li>
<li>输出地图</li>
<li>如果游戏未结束<ol>
<li>延时 1 秒</li>
<li>决策下一步并移动蛇，如果无法找出下一步则游戏结束</li>
<li>如果吃到食物则更新蛇的长度并生成新食物，如果蛇长度超过限制则游戏结束</li>
<li>清除屏幕</li>
<li>输出移动后的地图</li>
<li>重复上述过程</li>
</ol>
</li>
<li>如果游戏结束输出 <code>Game Over!!</code></li>
</ol>
        
          <div class="more-link">
            <a href="/2021/01/05/snake_ai/#more">Read On »</a>
          </div>
        
      
    </div>
</article>

    </li>
  
    <li>
      <article class='ListView'>
    <header class="title">
      
        <h1>
          <a href="/2020/12/30/snake/">贪吃蛇</a>
        </h1>
      
      <div class='ListMeta'>
  <time datetime="2020-12-30T15:36:30.475Z" itemprop="datePublished">
    2020-12-30
  </time>
  
  
  / 
  <ul>
    
  <li class="meta-text">
  { <a href="/categories/%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B%E5%AF%BC%E8%AE%BA/">软件工程导论</a> }
  </li>


  </ul>
  
</div>

    </header>
    <div>
      
        <h1 id="C-编写贪吃蛇小游戏"><a href="#C-编写贪吃蛇小游戏" class="headerlink" title="C 编写贪吃蛇小游戏"></a>C 编写贪吃蛇小游戏</h1><p>项目代码见：<a target="_blank" rel="noopener" href="https://gitee.com/hez2010/snake">https://gitee.com/hez2010/snake</a></p>
<h2 id="会动的蛇"><a href="#会动的蛇" class="headerlink" title="会动的蛇"></a>会动的蛇</h2><h3 id="整体框架"><a href="#整体框架" class="headerlink" title="整体框架"></a>整体框架</h3><p>整体流程为：</p>
<ol>
<li>输出地图</li>
<li>如果游戏未结束<ol>
<li>等待用户输入并移动蛇</li>
<li>输出移动后的地图</li>
<li>重复上述过程</li>
</ol>
</li>
<li>否则输出 <code>Game Over!!</code></li>
</ol>
        
          <div class="more-link">
            <a href="/2020/12/30/snake/#more">Read On »</a>
          </div>
        
      
    </div>
</article>

    </li>
  
    <li>
      <article class='ListView'>
    <header class="title">
      
        <h1>
          <a href="/2020/12/09/moral/">IT 行业巨头“垄断”的前世今生</a>
        </h1>
      
      <div class='ListMeta'>
  <time datetime="2020-12-08T16:04:47.932Z" itemprop="datePublished">
    2020-12-09
  </time>
  
  
  / 
  <ul>
    
  <li class="meta-text">
  { <a href="/categories/%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B%E5%AF%BC%E8%AE%BA/">软件工程导论</a> }
  </li>


  </ul>
  
</div>

    </header>
    <div>
      
        <h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>如今国内互联网行业能获得非常大的发展，有一部分原因是政策的宽松，然而2020年11月10日国家市场监管总局发布了《关于平台经济领域的反垄断指南（征求意见稿）》，针对反垄断问题给出了初步的意见，或许意味着是互联网行业宽松政策的转节点。</p>
<p><img src="/assets/moral/1.png" alt="1.png"></p>
<p>当天阿里、京东等巨头股价纷纷大跌，美团更是暴跌 13%。</p>
        
          <div class="more-link">
            <a href="/2020/12/09/moral/#more">Read On »</a>
          </div>
        
      
    </div>
</article>

    </li>
  
    <li>
      <article class='ListView'>
    <header class="title">
      
        <h1>
          <a href="/2020/11/25/python/">用 Python 做计算器</a>
        </h1>
      
      <div class='ListMeta'>
  <time datetime="2020-11-25T12:29:30.094Z" itemprop="datePublished">
    2020-11-25
  </time>
  
  
  / 
  <ul>
    
  <li class="meta-text">
  { <a href="/categories/%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B%E5%AF%BC%E8%AE%BA/">软件工程导论</a> }
  </li>


  </ul>
  
</div>

    </header>
    <div>
      
        <h1 id="使用-Python-求解数学题"><a href="#使用-Python-求解数学题" class="headerlink" title="使用 Python 求解数学题"></a>使用 Python 求解数学题</h1><h2 id="高等数学"><a href="#高等数学" class="headerlink" title="高等数学"></a>高等数学</h2><h3 id="1-解不定积分："><a href="#1-解不定积分：" class="headerlink" title="1. 解不定积分："></a>1. 解不定积分：<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>∫</mo><mrow><msup><mo><mi>cot</mi><mo>⁡</mo></mo><mn>4</mn></msup><mi>x</mi><mi>d</mi><mi>x</mi></mrow></mrow><annotation encoding="application/x-tex">\int{\cot^4{x}dx} </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.125208em;vertical-align:-0.30612em;"></span><span class="mop op-symbol small-op" style="margin-right:0.19445em;position:relative;top:-0.0005599999999999772em;">∫</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mop"><span class="mop">cot</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8190879999999999em;"><span style="top:-3.0679800000000004em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">4</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord mathnormal">x</span></span><span class="mord mathnormal">d</span><span class="mord mathnormal">x</span></span></span></span></span></h3><p>求解：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs python"><span class="hljs-keyword">from</span> sympy <span class="hljs-keyword">import</span> *<br>x = symbols(<span class="hljs-string">&#x27;x&#x27;</span>)<br>integrate(cot(x)**<span class="hljs-number">4</span>)<br></code></pre></td></tr></table></figure>

<p>输出：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs python">x + cos(x)/sin(x) - cos(x)**<span class="hljs-number">3</span>/(<span class="hljs-number">3</span>*sin(x)**<span class="hljs-number">3</span>)<br></code></pre></td></tr></table></figure>
        
          <div class="more-link">
            <a href="/2020/11/25/python/#more">Read On »</a>
          </div>
        
      
    </div>
</article>

    </li>
  
    <li>
      <article class='ListView'>
    <header class="title">
      
        <h1>
          <a href="/2020/11/11/homework/9/">09-数据抽象</a>
        </h1>
      
      <div class='ListMeta'>
  <time datetime="2020-11-11T14:54:11.325Z" itemprop="datePublished">
    2020-11-11
  </time>
  
  
  / 
  <ul>
    
  <li class="meta-text">
  { <a href="/categories/%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B%E5%AF%BC%E8%AE%BA/">软件工程导论</a> }
  </li>


  </ul>
  
</div>

    </header>
    <div>
      
        <h1 id="Homework-9"><a href="#Homework-9" class="headerlink" title="Homework 9"></a>Homework 9</h1><h2 id="Bubble-Sort-the-list-33-56-17-8-95-22。"><a href="#Bubble-Sort-the-list-33-56-17-8-95-22。" class="headerlink" title="Bubble Sort the list: 33, 56, 17, 8, 95, 22。"></a>Bubble Sort the list: 33, 56, 17, 8, 95, 22。</h2><p>Make sure the final result is from small to large.</p>
<p>Write out the list after the 2nd pass.</p>
<p>第一趟结果：8, 33, 56, 17, 22, 95 </p>
<p>第二趟结果：8, 17, 33, 56, 22, 95 </p>
<h2 id="Give-a-sorted-array-as-list-60-65-75-80-90-95-Design-an-algorithm-to-insert-the-value-of-x-into-the-sorted-array-Then-test-the-algorithm-with-value-50-67-99"><a href="#Give-a-sorted-array-as-list-60-65-75-80-90-95-Design-an-algorithm-to-insert-the-value-of-x-into-the-sorted-array-Then-test-the-algorithm-with-value-50-67-99" class="headerlink" title="Give a sorted array as list={60,65,75,80,90,95}. Design an algorithm to insert the value of x into the sorted array. Then test the algorithm with value 50,67,99."></a>Give a sorted array as list={60,65,75,80,90,95}. Design an algorithm to insert the value of x into the sorted array. Then test the algorithm with value 50,67,99.</h2><p>使用二分查找算法找到合适的位置进行插入。</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br></pre></td><td class="code"><pre><code class="hljs cpp"><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;vector&gt;</span></span><br><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;iostream&gt;</span></span><br><br><span class="hljs-built_in">std</span>::<span class="hljs-built_in">vector</span>&lt;<span class="hljs-keyword">int</span>&gt; <span class="hljs-built_in">list</span> = &#123;<span class="hljs-number">60</span>,<span class="hljs-number">65</span>,<span class="hljs-number">75</span>,<span class="hljs-number">80</span>,<span class="hljs-number">90</span>,<span class="hljs-number">95</span>&#125;;<br><br><span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">print</span><span class="hljs-params">()</span> </span>&#123;<br>    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">auto</span> &amp;i : <span class="hljs-built_in">list</span>) &#123;<br>        <span class="hljs-built_in">std</span>::<span class="hljs-built_in">cout</span> &lt;&lt; i &lt;&lt; <span class="hljs-string">&quot; &quot;</span>;<br>    &#125;<br>    <span class="hljs-built_in">std</span>::<span class="hljs-built_in">cout</span> &lt;&lt; <span class="hljs-built_in">std</span>::<span class="hljs-built_in">endl</span>;<br>&#125;<br><br><span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">insert</span><span class="hljs-params">(<span class="hljs-keyword">int</span> l, <span class="hljs-keyword">int</span> r, <span class="hljs-keyword">int</span> value)</span> </span>&#123;<br>    <span class="hljs-keyword">if</span> (l == r) &#123;<br>      <span class="hljs-built_in">list</span>.insert(<span class="hljs-built_in">list</span>.begin() + l + (<span class="hljs-built_in">list</span>[l] &gt;= value ? <span class="hljs-number">0</span> : <span class="hljs-number">1</span>), value);<br>      <span class="hljs-keyword">return</span>;<br>    &#125;<br>    <span class="hljs-keyword">int</span> mid = (l + r) / <span class="hljs-number">2</span>;<br>    <span class="hljs-keyword">if</span> (<span class="hljs-built_in">list</span>[mid] &lt; value) &#123;<br>        insert(mid + <span class="hljs-number">1</span>, r, value);<br>    &#125;<br>    <span class="hljs-keyword">else</span> &#123;<br>        insert(l, mid, value);<br>    &#125;<br>&#125;<br><br><span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">()</span> </span>&#123;<br>    insert(<span class="hljs-number">0</span>, <span class="hljs-built_in">list</span>.size() - <span class="hljs-number">1</span>, <span class="hljs-number">50</span>);<br>    print();<br>    insert(<span class="hljs-number">0</span>, <span class="hljs-built_in">list</span>.size() - <span class="hljs-number">1</span>, <span class="hljs-number">67</span>);<br>    print();<br>    insert(<span class="hljs-number">0</span>, <span class="hljs-built_in">list</span>.size() - <span class="hljs-number">1</span>, <span class="hljs-number">99</span>);<br>    print();<br>&#125;<br></code></pre></td></tr></table></figure>

<p>输出：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs none">50 60 65 75 80 90 95 <br>50 60 65 67 75 80 90 95 <br>50 60 65 67 75 80 90 95 99 <br></code></pre></td></tr></table></figure>

<h3 id="思考：为什么选择插入点在list头上、中间、尾巴上的三个数作为算法测试的数据，你能解释吗？"><a href="#思考：为什么选择插入点在list头上、中间、尾巴上的三个数作为算法测试的数据，你能解释吗？" class="headerlink" title="思考：为什么选择插入点在list头上、中间、尾巴上的三个数作为算法测试的数据，你能解释吗？"></a>思考：为什么选择插入点在list头上、中间、尾巴上的三个数作为算法测试的数据，你能解释吗？</h3><p>因为在中间的时候需要判断定位到的位置下原来的数和待插入的数的大小关系，在头上的时候需要插入到最前面，而在尾巴上则需要插入到最后面，较容易出错。</p>
<h2 id="What-is-the-state-of-the-stack-after-the-following-sequence-of-Push-and-Pop-operations"><a href="#What-is-the-state-of-the-stack-after-the-following-sequence-of-Push-and-Pop-operations" class="headerlink" title="What is the state of the stack after the following sequence of Push and Pop operations?"></a>What is the state of the stack after the following sequence of Push and Pop operations?</h2><p>Push “anne”; Push “get”; Push “your” ; Pop; Push “my” Push “gun”</p>
<p>栈的变化如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><code class="hljs none">anne<br>get anne<br>your get anne<br>get anne<br>my get anne<br>gun my get anne<br></code></pre></td></tr></table></figure>

<p>所以最后结果是：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs none">gun my get anne<br></code></pre></td></tr></table></figure>

      
    </div>
</article>

    </li>
  
    <li>
      <article class='ListView'>
    <header class="title">
      
        <h1>
          <a href="/2020/11/07/pesudo/">伪代码洗衣机</a>
        </h1>
      
      <div class='ListMeta'>
  <time datetime="2020-11-07T11:45:19.080Z" itemprop="datePublished">
    2020-11-07
  </time>
  
  
  / 
  <ul>
    
  <li class="meta-text">
  { <a href="/categories/%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B%E5%AF%BC%E8%AE%BA/">软件工程导论</a> }
  </li>


  </ul>
  
</div>

    </header>
    <div>
      
        <h1 id="自顶向下，逐步求精"><a href="#自顶向下，逐步求精" class="headerlink" title="自顶向下，逐步求精"></a>自顶向下，逐步求精</h1><p>“自顶向下”的具体内涵是将复杂、大的问题划分为小问题，找出问题的关键、重点所在，然后用精确的思维定性、定量地去描述问题。而“逐步求精”的具体内涵是是将现实世界的问题经抽象转化为逻辑空间或求解空间的问题。复杂问题经抽象化处理变为相对比较简单的问题。经若干步抽象（精化）处理，最后到求解域中只是比较简单的编程问题。</p>
<h1 id="洗衣过程"><a href="#洗衣过程" class="headerlink" title="洗衣过程"></a>洗衣过程</h1><p>洗衣服的过程分为：</p>
<ul>
<li>注水</li>
<li>浸泡</li>
<li>洗涤</li>
<li>排水</li>
<li>干燥</li>
<li>关机</li>
</ul>
<h1 id="一些函数"><a href="#一些函数" class="headerlink" title="一些函数"></a>一些函数</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><code class="hljs none">water_in_switch(open_close) &#x2F;&#x2F; open 打开上水开关，close关闭 <br>water_out_switch(open_close) &#x2F;&#x2F; open 打开排水开关，close关闭<br>get_water_volume() &#x2F;&#x2F;返回洗衣机内部水的高度<br>motor_run(direction) &#x2F;&#x2F; 电机转动。left左转，right右转，stop停 <br>time_counter() &#x2F;&#x2F; 返回当前时间计数，以秒为单位<br>halt(returncode) &#x2F;&#x2F;停机，success 成功 failure 失败<br></code></pre></td></tr></table></figure>
        
          <div class="more-link">
            <a href="/2020/11/07/pesudo/#more">Read On »</a>
          </div>
        
      
    </div>
</article>

    </li>
  
    <li>
      <article class='ListView'>
    <header class="title">
      
        <h1>
          <a href="/2020/11/07/programming-barely/">硬件编程——机器指令编程</a>
        </h1>
      
      <div class='ListMeta'>
  <time datetime="2020-11-07T10:54:48.681Z" itemprop="datePublished">
    2020-11-07
  </time>
  
  
  / 
  <ul>
    
  <li class="meta-text">
  { <a href="/categories/%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B%E5%AF%BC%E8%AE%BA/">软件工程导论</a> }
  </li>


  </ul>
  
</div>

    </header>
    <div>
      
        <p>硬件编程——机器指令编程</p>
<p>利用机器指令控制冯诺依曼计算机执行程序。</p>
<p>17364025 贺恩泽</p>
<h1 id="实验目的"><a href="#实验目的" class="headerlink" title="实验目的"></a>实验目的</h1><ul>
<li>理解冯·诺伊曼计算机的结构</li>
<li>理解机器指令的构成</li>
<li>理解机器指令执行周期</li>
<li>用汇编编写简单程序</li>
</ul>
<h1 id="实验-学习工具"><a href="#实验-学习工具" class="headerlink" title="实验/学习工具"></a>实验/学习工具</h1><p>简单 CPU 仿真工具 Pippin CPUSim</p>
<h2 id="实验环境环境"><a href="#实验环境环境" class="headerlink" title="实验环境环境"></a>实验环境环境</h2><ul>
<li><p>windows 7 或 以下</p>
</li>
<li><p>浏览器 IE 8 或 以下</p>
</li>
<li><p>Java Runtime Environment 1.6（JRE 6.0）或 以下</p>
<h2 id="网址"><a href="#网址" class="headerlink" title="网址"></a>网址</h2></li>
<li><p><a target="_blank" rel="noopener" href="http://www.science.smith.edu/~jcardell/Courses/CSC103/CPUsim/cpusim.html">http://www.science.smith.edu/~jcardell/Courses/CSC103/CPUsim/cpusim.html</a></p>
</li>
</ul>
<p>如果你的设备不符合以上要求，则需要安装虚拟机</p>
        
          <div class="more-link">
            <a href="/2020/11/07/programming-barely/#more">Read On »</a>
          </div>
        
      
    </div>
</article>

    </li>
  
    <li>
      <article class='ListView'>
    <header class="title">
      
        <h1>
          <a href="/2020/11/07/homework/8/">08-解决问题</a>
        </h1>
      
      <div class='ListMeta'>
  <time datetime="2020-11-07T09:14:50.519Z" itemprop="datePublished">
    2020-11-07
  </time>
  
  
  / 
  <ul>
    
  <li class="meta-text">
  { <a href="/categories/%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B%E5%AF%BC%E8%AE%BA/">软件工程导论</a> }
  </li>


  </ul>
  
</div>

    </header>
    <div>
      
        <h1 id="Homework"><a href="#Homework" class="headerlink" title="Homework"></a>Homework</h1><h2 id="阅读-Pseudocode-Standard"><a href="#阅读-Pseudocode-Standard" class="headerlink" title="阅读 Pseudocode Standard"></a>阅读 Pseudocode Standard</h2><h3 id="用伪代码描述将十进制转换成16进制的方法"><a href="#用伪代码描述将十进制转换成16进制的方法" class="headerlink" title="用伪代码描述将十进制转换成16进制的方法"></a>用伪代码描述将十进制转换成16进制的方法</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><code class="hljs pdl">READ input<br>SET result to &quot;&quot;<br>SET isneg to false<br>IF input &lt; 0 THEN<br>    SET isneg to true<br>    SET input to -input<br>ENDIF<br><br>WHILE input &gt; 0<br>    SET a to input % 16<br>    SET input to input &#x2F; 16<br>    SET bit to a + &#39;0&#39;<br>    IF a &gt; 9 THEN<br>        SET bit to bit - &#39;9&#39; - 1 + &#39;A&#39;<br>    ENDIF<br>    INSERT bit to result at position 0<br>ENDWHILE<br><br>IF result &#x3D;&#x3D; &quot;&quot;<br>    SET result to &quot;0&quot;<br>ENDIF<br><br>IF igneg THEN<br>    INSERT &#39;-&#39; to result at position 0<br>ENDIF<br><br>PRINT result<br></code></pre></td></tr></table></figure>
        
          <div class="more-link">
            <a href="/2020/11/07/homework/8/#more">Read On »</a>
          </div>
        
      
    </div>
</article>

    </li>
  
    <li>
      <article class='ListView'>
    <header class="title">
      
        <h1>
          <a href="/2020/11/07/homework/7/">07-机器指令编程</a>
        </h1>
      
      <div class='ListMeta'>
  <time datetime="2020-11-07T08:38:49.282Z" itemprop="datePublished">
    2020-11-07
  </time>
  
  
  / 
  <ul>
    
  <li class="meta-text">
  { <a href="/categories/%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B%E5%AF%BC%E8%AE%BA/">软件工程导论</a> }
  </li>


  </ul>
  
</div>

    </header>
    <div>
      
        <h1 id="Homework"><a href="#Homework" class="headerlink" title="Homework"></a>Homework</h1><h2 id="Program-with-machine-language-according-to-the-following-c"><a href="#Program-with-machine-language-according-to-the-following-c" class="headerlink" title="Program with machine language according to the following c"></a>Program with machine language according to the following c</h2><figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs c">int_8 a = <span class="hljs-number">1</span>;<br>int_8 c = a + <span class="hljs-number">3</span>;<br></code></pre></td></tr></table></figure>

<h3 id="Write-your-assembly-code-amp-machine-code"><a href="#Write-your-assembly-code-amp-machine-code" class="headerlink" title="Write your assembly code &amp; machine code"></a>Write your assembly code &amp; machine code</h3><p>汇编代码：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs asm">LOD #1<br>STO A<br>ADD #3<br>STO C<br></code></pre></td></tr></table></figure>

<p>首先加载立即数 1 到累加寄存器，将结果存入 A，然后加 3，再存入 C 即可。</p>
<p>机器代码：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs bin">00000100 00000001<br>00000101 10000011<br>00010000 00000011<br>00000101 10000101<br></code></pre></td></tr></table></figure>

<p>这里假设 A 和 C 的内存地址分别为 <code>10000011</code> 和 <code>10000101</code>。</p>
<h3 id="Explain-machine-code-execution-with-the-fetch-decode-execute-cycle"><a href="#Explain-machine-code-execution-with-the-fetch-decode-execute-cycle" class="headerlink" title="Explain machine code execution with the fetch-decode-execute cycle"></a>Explain machine code execution with the fetch-decode-execute cycle</h3><p>在一个取指-译码-执行循环中：</p>
<ol>
<li>PC 寄存器中保存了下一条指令的地址，CPU 从内存中读入指令并存入 IR 寄存器，即为取指。</li>
<li>CPU 根据 IR 寄存器中的指令，将其内容解析为操作码和操作数等，即为译码。</li>
<li>CPU 根据解析出的指令，根据不同的操作码执行不同的命令，并传送操作数中的内容作为参数，即为执行。例如让 ALU 单元进行加法计算等等。</li>
</ol>
<h3 id="Explain-functions-about-IR-PC-ACC-registers-in-a-CPU"><a href="#Explain-functions-about-IR-PC-ACC-registers-in-a-CPU" class="headerlink" title="Explain functions about IR, PC, ACC registers in a CPU"></a>Explain functions about IR, PC, ACC registers in a CPU</h3><ul>
<li>IR 寄存器：指令寄存器，存储当前执行的指令内容</li>
<li>PC 寄存器：存储下一条指令的地址，CPU 将会从该地址读取下一条指令</li>
<li>ACC 寄存去：累加寄存器，该寄存器可用于对数值进行累加，常用于存放计算的中间结果等</li>
</ul>
<h3 id="Explain-physical-meaning-about-vars-a-amp-c-in-a-machine"><a href="#Explain-physical-meaning-about-vars-a-amp-c-in-a-machine" class="headerlink" title="Explain physical meaning about vars a &amp; c in a machine"></a>Explain physical meaning about vars a &amp; c in a machine</h3><p>变量 <code>a</code> 和 <code>c</code> 的物理意义对应了再内存中不同的地址。编译器将 C 语言编译后，这些变量便被赋予了不同的内存地址，这些地址是这些变量的起始内存地址，根据不同的变量类型占有不同的长度。在 CPU 对这些变量进行操作时，需要从内存中读取到寄存器，或从寄存器写入到内存的相应地址的块中。</p>
        
          <div class="more-link">
            <a href="/2020/11/07/homework/7/#more">Read On »</a>
          </div>
        
      
    </div>
</article>

    </li>
  
    <li>
      <article class='ListView'>
    <header class="title">
      
        <h1>
          <a href="/2020/10/14/homework/6/">06-计算机组成</a>
        </h1>
      
      <div class='ListMeta'>
  <time datetime="2020-10-13T16:29:58.801Z" itemprop="datePublished">
    2020-10-14
  </time>
  
  
  / 
  <ul>
    
  <li class="meta-text">
  { <a href="/categories/%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B%E5%AF%BC%E8%AE%BA/">软件工程导论</a> }
  </li>


  </ul>
  
</div>

    </header>
    <div>
      
        <h1 id="Homework"><a href="#Homework" class="headerlink" title="Homework"></a>Homework</h1><h2 id="According-to-the-von-Neumann-architecture-List-basic-parts-of-a-computer"><a href="#According-to-the-von-Neumann-architecture-List-basic-parts-of-a-computer" class="headerlink" title="According to the von Neumann architecture, List basic parts of a computer"></a>According to the von Neumann architecture, List basic parts of a computer</h2><ul>
<li>控制器</li>
<li>运算器</li>
<li>存储器</li>
<li>输入设备</li>
<li>输出设备</li>
</ul>
<h2 id="A-computer-has-64-MB-megabytes-of-memory-How-many-bits-are-needed-to-address-any-single-byte-in-memory"><a href="#A-computer-has-64-MB-megabytes-of-memory-How-many-bits-are-needed-to-address-any-single-byte-in-memory" class="headerlink" title="A computer has 64 MB (megabytes) of memory. How many bits are needed to address any single byte in memory?"></a>A computer has 64 MB (megabytes) of memory. How many bits are needed to address any single byte in memory?</h2><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>64</mn><mi>M</mi><mi>B</mi><mo>=</mo><msup><mn>2</mn><mn>26</mn></msup><mi>b</mi><mi>y</mi><mi>t</mi><mi>e</mi><mi>s</mi></mrow><annotation encoding="application/x-tex">64 MB = 2^{26} bytes </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord">6</span><span class="mord">4</span><span class="mord mathnormal" style="margin-right:0.10903em;">M</span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1.008548em;vertical-align:-0.19444em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141079999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span><span class="mord mtight">6</span></span></span></span></span></span></span></span></span><span class="mord mathnormal">b</span><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="mord mathnormal">t</span><span class="mord mathnormal">e</span><span class="mord mathnormal">s</span></span></span></span>

<p>所以需要 26 位地址线索引每个字节。</p>
<h2 id="List-basic-parts-of-a-CPU-include-cache-or-not"><a href="#List-basic-parts-of-a-CPU-include-cache-or-not" class="headerlink" title="List basic parts of a CPU, include cache or not?"></a>List basic parts of a CPU, include cache or not?</h2><ul>
<li>算数和逻辑单元</li>
<li>控制单元</li>
<li>总线和存储单元</li>
</ul>
<p>CPU 的组成中包含缓存。</p>
<h2 id="What-mean-secondary-storage-List-some-on-your-PC"><a href="#What-mean-secondary-storage-List-some-on-your-PC" class="headerlink" title="What mean secondary storage. List some on your PC."></a>What mean secondary storage. List some on your PC.</h2><p>二级存储器是指计算机主存储器外的所有可访问数据存储器。</p>
<p>例如：</p>
<ul>
<li>磁带</li>
<li>硬盘</li>
<li>光碟</li>
<li>存储卡</li>
<li>U 盘</li>
</ul>
<h2 id="使用维基百科，解释概念"><a href="#使用维基百科，解释概念" class="headerlink" title="使用维基百科，解释概念"></a>使用维基百科，解释概念</h2><h3 id="CPU"><a href="#CPU" class="headerlink" title="CPU"></a>CPU</h3><p>A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry within a computer that executes instructions that make up a computer program. The CPU performs basic arithmetic, logic, controlling, and input/output (I/O) operations specified by the instructions in the program.</p>
<h3 id="RAM"><a href="#RAM" class="headerlink" title="RAM"></a>RAM</h3><p>Random-access memory is a form of computer memory that can be read and changed in any order, typically used to store working data and machine code. A random-access memory device allows data items to be read or written in almost the same amount of time irrespective of the physical location of data inside the memory.</p>
<h3 id="ROM"><a href="#ROM" class="headerlink" title="ROM"></a>ROM</h3><p>Read-only memory (ROM) is a type of non-volatile memory used in computers and other electronic devices. Data stored in ROM cannot be electronically modified after the manufacture of the memory device.</p>
<h3 id="Bus-computing"><a href="#Bus-computing" class="headerlink" title="Bus (computing)"></a>Bus (computing)</h3><p>In computer architecture, a bus (a contraction of the Latin omnibus[citation needed], and historically also called data highway) is a communication system that transfers data between components inside a computer, or between computers. This expression covers all related hardware components (wire, optical fiber, etc.) and software, including communication protocols.</p>
<h3 id="Parallel-Computing"><a href="#Parallel-Computing" class="headerlink" title="Parallel Computing"></a>Parallel Computing</h3><p>Parallel computing is a type of computation where many calculations or the execution of processes are carried out simultaneously.</p>
<h2 id="写一段文字，简单解释“云计算（cloud-computing）”"><a href="#写一段文字，简单解释“云计算（cloud-computing）”" class="headerlink" title="写一段文字，简单解释“云计算（cloud computing）”"></a>写一段文字，简单解释“云计算（cloud computing）”</h2><p>云计算是一种不需要用户在本地进行计算，而是通过将运算负载放置到服务器端，并分布式地将数据处理程序分解成多个服务进行处理，最后通过这些服务处理和分析数据得到最终结果返回给用户的一种技术。</p>
<p>“云”实际上就是指网络，各服务、用户与服务之间通过网络进行数据交互，这些计算资源共享池就叫做“云”。</p>
<p>云计算把许多计算资源集合起来，通过软件实现自动化管理，只需要很少的人参与，就能让资源被快速提供。</p>
<h2 id="小孙买了计算机主板，说明书表明“支持双通道DDR3-1333内存，-最大支持16G”"><a href="#小孙买了计算机主板，说明书表明“支持双通道DDR3-1333内存，-最大支持16G”" class="headerlink" title="小孙买了计算机主板，说明书表明“支持双通道DDR3-1333内存， 最大支持16G”"></a>小孙买了计算机主板，说明书表明“支持双通道DDR3-1333内存， 最大支持16G”</h2><h3 id="DDR3内存，“3”和“1333”的含义是什么？"><a href="#DDR3内存，“3”和“1333”的含义是什么？" class="headerlink" title="DDR3内存，“3”和“1333”的含义是什么？"></a>DDR3内存，“3”和“1333”的含义是什么？</h3><p>DDR3 中的 3 指的是第三代DDR-SDRAM内存条。</p>
<p>而后面的 1333 指的是该内存条的主频为 1333MHz。</p>
<h3 id="小孙买8G-DDR3-1600的内存能提高性能吗？"><a href="#小孙买8G-DDR3-1600的内存能提高性能吗？" class="headerlink" title="小孙买8G DDR3-1600的内存能提高性能吗？"></a>小孙买8G DDR3-1600的内存能提高性能吗？</h3><p>可以提升性能。</p>
<p>同样的内存，工作频率越高，内存能够提供的数据带宽就越大，理论上内存的性能就越好。</p>
<h3 id="小孙买4G-2-DDR3-1333的内存能提高性能吗？"><a href="#小孙买4G-2-DDR3-1333的内存能提高性能吗？" class="headerlink" title="小孙买4G*2 DDR3-1333的内存能提高性能吗？"></a>小孙买4G*2 DDR3-1333的内存能提高性能吗？</h3><p>可以提升性能。</p>
<p>多一条内存使得计算机拥有更大的内存，能够同时处理更多的任务，因此可以提升计算机的整体性能。</p>
<h3 id="16G需要多少位地址？"><a href="#16G需要多少位地址？" class="headerlink" title="16G需要多少位地址？"></a>16G需要多少位地址？</h3><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>16</mn><mi>G</mi><mi>B</mi><mo>=</mo><msup><mn>2</mn><mn>34</mn></msup><mi>b</mi><mi>y</mi><mi>t</mi><mi>e</mi><mi>s</mi></mrow><annotation encoding="application/x-tex">16 GB = 2^{34} bytes </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord">1</span><span class="mord">6</span><span class="mord mathnormal">G</span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1.008548em;vertical-align:-0.19444em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141079999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">3</span><span class="mord mtight">4</span></span></span></span></span></span></span></span></span><span class="mord mathnormal">b</span><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="mord mathnormal">t</span><span class="mord mathnormal">e</span><span class="mord mathnormal">s</span></span></span></span>

<p>需要 34 位地址。</p>

      
    </div>
</article>

    </li>
  
</ul>

  <section id="nav-wrapper">
    <nav id="page-nav">
      <span class="page-number current">1</span><a class="page-number" href="/categories/%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B%E5%AF%BC%E8%AE%BA/page/2/">2</a><a class="extend next" rel="next" href="/categories/%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B%E5%AF%BC%E8%AE%BA/page/2/">next »</a>
    </nav>
  </section>


            <footer>
    <div>© 2021 - Steven He </div>
    <div>
        <span>
            Powered by <a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a>
        </span>
        ,
        <span>
            Theme - <a target="_blank" rel="noopener" href="https://github.com/nameoverflow/hexo-theme-icalm">Icalm</a>
        </span>
    </div>
</footer>

        </div>
    </div>
</div>

<script src="/js/pager/dist/singlepager.js"></script>

<script>
var sp = new Pager('data-pager-shell')

</script>
</body>
</html>